﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using BCDataCenter.DataAccessLayer;

/// <summary>
/// Summary description for InCacNghiepVuKho
/// </summary>
namespace BCDataCenter.BOL
{
    public class BWInCacNghiepVuKho
    {
        string SqlGetListLoaiNghiepVu = "INTXD_GetList_LoaiNghiepVu";
        string SqlGetListSapXepTheo = "VSBITEMORDER";
        string SqlGetListChiTietNghiepVuInra = "INTX_GetListPrint";
        string SqlGetLisNghiepVuCanIn = "INTXD_GetList";
        string SqlPrintUpdate = "INTXD_Print_Update";
        string SqlGetTTPP = "getTTPP";
        
        public BWInCacNghiepVuKho()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public System.Data.DataSet GetListLoaiNghiepVu(ref string error)
        {
            return new DAL().MyExecuteReader(ref error, SqlGetListLoaiNghiepVu, System.Data.CommandType.StoredProcedure);
        }

        public System.Data.DataSet GetListSapXepTheo(ref string error)
        {
            return new DAL().MyExecuteReader(ref error, SqlGetListSapXepTheo, System.Data.CommandType.StoredProcedure);
        }
        public System.Data.DataSet GetListNghiepVuCanIn(ref string error, string trntyp, string Sitecode)
        {
            return new DAL().MyExecuteQuery(ref error, SqlGetLisNghiepVuCanIn, System.Data.CommandType.StoredProcedure, new SqlParameter("@trntyp",trntyp), new SqlParameter("@Sitecode", Sitecode));
        }

        public System.Data.DataSet GetListChiTietNghiepVuCanIn(ref string error, string trntyp, string docno)
        {
            return new DAL().MyExecuteQuery(ref error, SqlGetListChiTietNghiepVuInra, System.Data.CommandType.StoredProcedure, new SqlParameter("@trntyp", trntyp), new SqlParameter("@docno",docno));
        }

        public bool UpdatePrinted(ref string error, string docno)
        { 
            return new DAL().MyExecuteNonQuery(SqlPrintUpdate, System.Data.CommandType.StoredProcedure, ref error,new SqlParameter("@docno",docno));
        }

        public System.Data.DataSet GetTrungTamPP(ref string error,string Sitecode)
        {
            return new DAL().MyExecuteQuery(ref error, SqlGetTTPP, System.Data.CommandType.StoredProcedure,new SqlParameter("@Sitecode",Sitecode));
        }
    }
}
